package com.mantru.iotpot.job;

import org.json.JSONObject;

import java.util.ArrayList;
import  java.util.List;

/**
 * 经计算后的同一时间点的步骤集合
 */
public class CookingDetail {
    //集合序号，从1开始
    public int steep_index;
    //集合名称，这是一个组合值
    public String steep_name;
    //开始时长的缩写格式，格式mm:ss
    public String time_value;
    //开始时长，将time_value转换为秒的值，单位：秒
    public int time_long;
    //集合里关联的步骤列表
    public List<CookingSteep> list;
    //自动语音播报文本
    public String tts_text;
    //集合状态，0未执行、1执行中、2已完成
    public int steep_status;
    //总时长(秒)、已执行的时长(秒)
    public long total_time = 0, pass_time = 0;
    //是否含有调味料投放步骤
    public boolean is_contains_nozzle;

    public CookingDetail(int index){
        steep_index = index;
        steep_name = "";
        time_value = "";
        tts_text = "";
        list = new ArrayList<>();
        total_time = 0;
        pass_time = 0;
        steep_status = 0;
        time_long = 0;
        is_contains_nozzle = false;
    }

    public void AddSteep(CookingSteep steep) {
        list.add(steep);
        time_value = steep.time_value;
        time_long = steep.time_long;
        if (steep_name.length() > 0)
            steep_name += "、";
        steep_name += steep.steep_name;
        if (steep.steep_type == 2)
            is_contains_nozzle = true;
    }

}
